import java.util.Stack;

public class Brackets {

	private static final char CLOSING_BRACKET = ')';
	private static final char OPEN_BRACKET = '(';

	static boolean isExpressionBalanced(String expression) {
		Stack stack = new Stack();

		for (int index = 0; index < expression.length(); index++) {
			char c = expression.charAt(index);

			if (c == OPEN_BRACKET) {
				stack.push("baba");
			} else if (c == CLOSING_BRACKET) {
				if (stack.isEmpty())
					return false;
				else
					stack.pop();
			}
		}
		
		if (!stack.isEmpty())
			return false;
		return true;
	}
	
	public static void main(String[] args) {
		System.out.println(isExpressionBalanced("(()(()))()"));
	}
}
